'\" t
.\"     Title: IPSEC_PORTOF
.\"    Author: Paul Wouters
.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
.\"      Date: 12/16/2012
.\"    Manual: Executable programs
.\"    Source: libreswan
.\"  Language: English
.\"
.TH "IPSEC_PORTOF" "3" "12/16/2012" "libreswan" "Executable programs"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ipsec_portof, ipsec_setportof, ipsec_sockaddrof, ipsec_sockaddrlenof \- get port field of an ip_address, set port field of an ip_address, get pointer to internal sockaddr of an ip_address, get length of internal sockaddr of an ip_address
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <libreswan\&.h>

.fi
.ft
.HP \w'int\ portof('u
.BI "int portof(const\ ip_address\ *\ " "src" ");"
.HP \w'void\ setportof('u
.BI "void setportof(int\ " "port" ", ip_address\ *\ " "dst" ");"
.HP \w'struct\ sockaddr\ *sockaddrof('u
.BI "struct sockaddr *sockaddrof(ip_address\ *\ " "src" ");"
.HP \w'size_t\ sockaddrlenof('u
.BI "size_t sockaddrlenof(const\ ip_address\ *\ " "src" ");"
.SH "DESCRIPTION"
.PP
The
\fB<libreswan\&.h>\fR
internal type
\fIip_address\fR
contains one of the
\fBsockaddr\fR
types internally\&.
\fIReliance on this feature is discouraged\fR, but it may occasionally be necessary\&. These functions provide low\-level tools for this purpose\&.
.PP
\fIPortof\fR
and
\fBsetportof\fR
respectively read and write the port\-number field of the internal
\fBsockaddr\fR\&. The values are in network byte order\&.
.PP
\fISockaddrof\fR
returns a pointer to the internal
\fBsockaddr\fR, for passing to other functions\&.
.PP
\fISockaddrlenof\fR
reports the size of the internal
\fBsockaddr\fR, for use in storage allocation\&.
.SH "SEE ALSO"
.PP
\fBinet\fR(3),
\fBipsec_initaddr\fR(3)
.SH "DIAGNOSTICS"
.PP
\fIPortof\fR
returns
\fB\-1\fR,
\fIsockaddrof\fR
returns
\fBNULL\fR, and
\fBsockaddrlenof\fR
returns
0
if an unknown address family is found within the
\fIip_address\fR\&.
.SH "HISTORY"
.PP
Written for the FreeS/WAN project by Henry Spencer\&.
.SH "BUGS"
.PP
These functions all depend on low\-level details of the
\fIip_address\fR
type, which are in principle subject to change\&. Avoid using them unless really necessary\&.
.SH "AUTHOR"
.PP
\fBPaul Wouters\fR
.RS 4
placeholder to suppress warning
.RE
